package com.zfj.Generic;

/**
 * @author zfj
 * @date 2022/3/5 -19:10
 */
public class TestGeneric {
	public static void main(String[] args) {
		//注意：泛型只能是引用类型
		//不同的泛型类型对象不能相互赋值
		Demo1<String> myDemo=new Demo1<>();
		myDemo.t="hello";
		myDemo.show("测试");
		String t = myDemo.getT();

		Demo1<Integer> d1=new Demo1<>();
		d1.t=100;
		d1.show(50);
		System.out.println(d1.getT());

		MyInterfaceImpl impl=new MyInterfaceImpl();
		impl.server("hello world");

		MyInterfaceImpl2<Integer> impl2=new MyInterfaceImpl2();
		impl2.server(1000);

		MyGenericMethod method=new MyGenericMethod();
		method.show("hello");
		method.show(123);
		method.show(1.23);
	}
}
